using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Editor
{
    public abstract class MenuItem
    {
        protected Texture2D ItemSprite;
        protected Vector2 vPosition;
        protected MapArea mapArea;

        public int Width
        {
            get
            {
                return this.ItemSprite.Width;
            }
        }

        public MenuItem(MapArea mapArea, Texture2D spriteImage, Vector2 position)
        {
            this.mapArea = mapArea;
            this.ItemSprite = spriteImage;
            this.vPosition = position;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(this.ItemSprite, this.vPosition, Color.White);
        }

        /// <summary>
        /// Returns if the mouse is within the bounds of the menu item
        /// </summary>
        /// <param name="mouseState"></param>
        /// <returns>true if in menu item bounds</returns>
        public bool CheckForMouseOver(Vector2 vMousePosition)
        {
            Rectangle itemRectangle = new Rectangle((int)this.vPosition.X, (int)this.vPosition.Y, this.ItemSprite.Width, this.ItemSprite.Height);
            return itemRectangle.Contains((int)vMousePosition.X, (int)vMousePosition.Y);
        }

        public abstract void ClickAction();
    }
}
